use "dataset_city_selection_texas", clear
sort order
drop order

tostring mostr, format(%tdnn/dd/ccyy) replace force
tostring Pop Share, format(%20.0fc) replace force

replace mostr = "(Excluded)" if mostr == ""
replace prior = "" if prior == ""

foreach x of varlist City counties Population2010 ShareBlack ///
	mostrecentelectiondate {
	replace `x' = "\textbf{" + `x' + "}" if mostr != "(Excluded)"
	replace `x' = "\cellcolor{light-gray}" + `x' if ///
		regex(City, "Fort Worth")
}
replace City = "\hline\hline " + City if regex(City, "Fort Worth")
replace prior = "\cellcolor{light-gray}" + prior if regex(City, "Fort Worth")

#delimit;

listtex 
	using "_output/table A4.tex"
	,
		replace 
		type 
		rstyle(tabular) 	
		head(
		\begin{tabular}{
			l
			>{\raggedright\arraybackslash}p{0.12\linewidth}
			l
			l
			l
			>{\raggedright\arraybackslash}p{0.19\linewidth}
			}
			\toprule City & Counties & Population & 
				Share & Most Recent & 
				Prior \\
			& & & Black & Election & Elections \\
			\midrule
		)
		foot("\bottomrule\end{tabular}")
		;
		
#delimit cr
